using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QuanLyPhongKham
{
    public partial class ucAbout : BaseUserControl
    {
        private DAL.AccessData m;
        private int locaX,locaY;
        public string s_ten = "", s_diachi = "";
        private DataSet dsxml = new DataSet();
        public ucAbout(int loX,int loY,string ten,DAL.AccessData acc)
        {
            InitializeComponent();
            this.Text = ten;
            this.locaX = loX;
            this.locaY = loY;
            this.m = acc;
        }
        private void frmAbout_Load(object sender, EventArgs e)
        {
            this.Location = new Point(locaX, locaY);
            if (System.IO.File.Exists(@"..\..\..\xml\thongso.xml"))
            {
                dsxml.ReadXml(@"..\..\..\xml\thongso.xml");
                foreach (Control ctr in groupBox1.Controls)
                {
                    if (ctr.GetType().ToString() == "System.Windows.Forms.TextBox")
                    {
                        ctr.Text = m.ReadXml(dsxml, ctr.Name);
                    }
                }
            }
        }

        private void butKetthuc_Click(object sender, EventArgs e)
        {
            //fix:
            //this.Close();
        }

        private void name_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                SendKeys.Send("{Tab}");
            }
        }

        private void butOk_Click(object sender, EventArgs e)
        {
            foreach (Control ctr in groupBox1.Controls)
            {
                if (ctr.GetType().ToString() == "System.Windows.Forms.TextBox")
                {
                    m.writeXml("thongso", ctr.Name.ToString(), ctr.Text.Trim());
                }
            }
            //fix:
            //this.Close();
        }
    }
}